/*
 * @Author: 橘子
 * @Date: 2022-10-07 11:45:25
 * @Project_description: common
 * @Description: 代码是我抄的，不会也是真的
 */
import fun from '@/libs/util.function'
import setting from '@/setting'

export default {
  methods: {
    /**
     * @desc:  复制文本
     * @param {*} text 文本
     * @return {*}
     * @Author: 橘子
     */
    _copy(text) {
      this.$copyText(text)
        .then(() => {
          this.$message.success('复制成功')
        })
        .catch((err) => {
          this.$message.error('复制失败')
          this.$log.push(err)
        })
    },
    /**
     * @desc:  docx
     * @param {*} options 请看文档https://view.xdocin.com/view-xdocin-com_mkzvhm.htm#h_761280372
     * @return {*}
     * @Author: 橘子
     */
    _xdoc(options = {}) {
      let datas = {
        _func: 'run',
        _key: setting.xdoc.key,
        _xdoc: options.xodc || '测试文档.docx',
        _format: options.format || 'docx',
        ...options.data,
      }
      let url = setting.xdoc.server + fun.js_toParams(datas)
      this.$open(url)
    },
  },
}
